//
//  MineAddressTableViewCell.m
//  MJApp
//
//  Created by wangliang on 15/3/29.
//  Copyright (c) 2015年 wangliang. All rights reserved.
//

#import "MineAddressTableViewCell.h"

@interface MineAddressTableViewCell ()

@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UILabel *phoneLabel;
@property (weak, nonatomic) IBOutlet UILabel *descLabel;


@end

@implementation MineAddressTableViewCell

+ (instancetype)initWithTableView:(UITableView *)tableView {
    
    static NSString *cellID = @"MineAddressTableViewCell";
    MineAddressTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    if (cell == nil) {
        
        cell =  WL_XIB(@"MineAddressTableViewCell");
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    cell.cellHigh = CGRectGetHeight(cell.frame);
    return cell;
    
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    
    [super setSelected:selected animated:animated];
//    if (selected) {
//        
//        self.backView.backgroundColor = RGB(99, 95, 138);
//    }else {
//        
//        self.backView.backgroundColor = [UIColor whiteColor];
//    }
//    
}

- (void)setInfoDic:(NSDictionary *)infoDic {
    
    _infoDic = infoDic;
    
    self.nameLabel.text = infoDic[@"name"];
    self.phoneLabel.text = infoDic[@"phone"];
    self.descLabel.text = [NSString stringWithFormat:@"%@%@%@%@",infoDic[@"economize"],infoDic[@"city"],infoDic[@"area"],infoDic[@"address"]];
    if ([infoDic[@"defaultAddress"] integerValue] == 1) {
        
        self.defaultImageView.hidden = NO;
    }else {
        
        self.defaultImageView.hidden = YES;
    }
}

@end
